]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/icon: Simplify property setting in set_gicon()
authorJonas Dreßler <verdre@v0yd.nl>
Thu, 21 Nov 2019 10:17:44 +0000 (17:17 +0700)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 13 Jan 2020 13:44:08 +0000 (14:44 +0100)
We can easily use `g_set_object()` to set the gicon property here.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888

src/st/st-icon.c

index 133209d1e6bc02184a39d68b13e90b0a92241c10..0f9aa43d22aa6dc1c1dab815d54ede1103d14846 100644 (file)
@@ -572,15 +572,7 @@ st_icon_set_gicon (StIcon *icon, GIcon *gicon)
   if (g_icon_equal (icon->priv->gicon, gicon)) /* do nothing */
     return;
 
-  if (icon->priv->gicon)
-    {
-      g_object_unref (icon->priv->gicon);
-      icon->priv->gicon = NULL;
-    }
-
-  if (gicon)
-    icon->priv->gicon = g_object_ref (gicon);
-
+  g_set_object (&icon->priv->gicon, gicon);
   g_object_notify_by_pspec (G_OBJECT (icon), props[PROP_GICON]);
 
   st_icon_update (icon);